package com.xoa.controller.affair;

import com.xoa.model.affair.Affair;
import com.xoa.model.affair.AffairWithBLOBs;
import com.xoa.model.calender.Calendar;
import com.xoa.service.affair.AffairServiceImpl;
import com.xoa.util.ToJson;
import org.apache.http.HttpRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;

/**
 * @author 左春晖
 *               周期性事务控制层
 *@date 2018/6/6 10:29
 * @desc
 */
@Controller
@RequestMapping("/Affair")
public class AffairConteoller {

   @Resource
   private  AffairServiceImpl affairService;

    //添加
    @ResponseBody
    @RequestMapping("/insertAffair")//  /Affair/insertAffair
    public ToJson insertSelective(HttpServletRequest request,AffairWithBLOBs affairWithBLOBs,String smsRemind){
        return affairService.insertAffair(request,affairWithBLOBs,smsRemind);}
    //修改
    @ResponseBody
    @RequestMapping("/updateAffair")//  /Affair/updateAffair
    public ToJson updateByExampleSelective(HttpServletRequest request ,AffairWithBLOBs affairWithBLOBs, String smsRemind){
        return affairService.updateAffair(request,affairWithBLOBs ,smsRemind);
    }
    //删除
    @ResponseBody
    @RequestMapping("/deleteAffair")//  /Affair/deleteAffair
    public ToJson deleteByPrimaryKey(HttpServletRequest request,Integer affId){
        return affairService.delete(request,affId);
    }

    //查询
    @ResponseBody
    @RequestMapping("/selectAffair")//  /Affair/selectAffair
    public ToJson select(HttpServletRequest request,AffairWithBLOBs affairWithBLOBs,Integer page, Integer pageSize,boolean useFlag){
        return affairService.select( request,affairWithBLOBs,page,pageSize,useFlag);}
}
